<template>
  <div id="app">
    <Home v-if="user"></Home>
    <login v-else :user="user" @changeuser="changeuser"></login>
  </div>
</template>

<script>
import Home from "./views/Home.vue";
import login from "./views/login.vue";
export default {
    name: "app",
    components: {
        Home, login
    },
    data() {
        return {
            user: this.$store.state.user
        };
    },
    created() {
    },
    methods:{
      changeuser(data){
        console.log(data);
        this.user = data;
        this.$store.commit('login')
      }
    }
};
</script>
<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
